<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="telephone=no" name="format-detection" /> 
    
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>登录</title>
    <style type="text/css">
    html, body, div,section,article,canvas,header,footer,figure,figcaption,nav span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, dd, dl, dt, li, ol, ul,input,select,button,textarea,table,tr,td{ padding:0; margin:0; border:none;outline: none;}
	input,button,select,textarea,a,img{outline:none; text-decoration:none;color:#333;-webkit-tap-highlight-color:rgba(255,0,0,0);border:none;}
	section,article,header,footer,figure,figcaption,nav,canvas{display:block;}
	::-moz-focus-inner{border:0px;}
	body {font-size:10px; font-family: -apple-system-font,Helvetica Neue,sans-serif,"Microsoft YaHei","Arial", "SimSun";}
	html,body{width:100%;height:100%;overflow:hidden;background:#f2f2f2;-moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; -khtml-user-select: none; user-select: none; }
	ul, ul li, ol li, li {  list-style:none;}
	table { border-collapse: collapse;border-spacing:0;}
	input, textarea {border: 0;vertical-align: middle;}
	.clearfix:after {visibility: hidden;display: block;font-size: 0;content: ".";clear: both;height: 0;}
	* html .clearfix {zoom: 1;}
	*:first-child + html .clearfix {zoom: 1;}
	
	.fl {   float:left;}
	.fr {   float:right;}
	.none{  display:none;}
	.elip{white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
	*{box-sizing: border-box;-webkit-box-sizing:border-box;}
	.delsite_btn{position:relative;display:block;margin-left:auto;margin-right:auto;padding-left:14px;padding-right:14px;box-sizing:border-box;font-size:18px;text-align:center;text-decoration:none;color:#fff;border-radius:30px;overflow:hidden;background-color:#57b416;margin:0 15px 15px 15px;width:90%;height:50px;}
	.pop_picker{width:100%;height:100%;background:url(src/img/appbg.png) no-repeat center;background-size:cover;}
	.pop_login{display:block;border-radius:5px;position:absolute;bottom:0;left:10px;right:10px;font-size:14px}
	.pop_login .header{width:90%;line-height:30px;padding:10px 5%;border-bottom:1px solid #ebebeb;overflow:hidden;display:block;font-size:16px}
	.pop_login .login_cont{padding:10px 5%;overflow:hidden}
	.pop_login .login_tit{font-size:14px;padding:10px 0}
	.pop_login .input_group{position:relative;display:inline-flex;border-collapse:separate;width:100%;margin:10px 0}
	.pop_login .login_input{padding:8px 5%;line-height:30px;font-size:14px;width:100%;text-align:left;color:#555;vertical-align:middle;background-color:#ebe6f0;border:1px solid #ebebeb;border-radius:30px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);}
	.pop_login .input_icon{width:22px;padding:6px 12px;color:#555;text-align:center;background-color:#f9f9f9;border-top:1px solid #ebebeb;border-left:1px solid #ebebeb;border-bottom:1px solid #ebebeb;border-top-left-radius:4px;border-bottom-left-radius:4px;border-top-right-radius:0;border-bottom-right-radius:0;display:table-cell;white-space:nowrap;vertical-align:middle;box-sizing:content-box;}
	.login_icon_user{background:url(src/img/login_user.svg) no-repeat center center;background-size:50%;display:inline-block;overflow:hidden}
	.login_icon_password{background:url(src/img/login_password.svg) no-repeat center center;background-size:50%;display:inline-block;overflow:hidden}
	.login_icon_wjmm{width:22px;height:22px;background:url(src/img/login_wjmm.svg) no-repeat center center;background-size:80%;display:inline-block;overflow:hidden;margin-right:5px;vertical-align: middle;}
	.login_wjmm{margin:0 15px 15px 0;line-height:22px;float:right}
	.pop_login input:-webkit-autofill{
		-webkit-box-shadow:0 0 0px 1000px white inset; 
		border: 1px solid #CCC!important;
	}
	.getcode{width:60px;background: transparent;border:1px solid #ebe6f0;color:#ebe6f0;margin-left:10px;border-radius:10px;font-size:14px;}
    </style>
	<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script src="/src/js/share.js?__version=9.4"></script>
	<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?8ed2efe5b24e14f351f4d88ba2eb3462";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
</head>
<body>
	<section class="pop_picker">
	    <div class="pop_login">
	        <div class="login_cont borderbottom_line">
	            <div class="input_group  mb10">
	            	<input id="account" type="tel" pattern="[0-9]*" placeholder="请输入手机号" class="login_input" autocomplete="new-phone">
	            </div>
	            <div class="input_group mb10">
	            	<input type="text" id="code" placeholder="请输入验证码" class="login_input" autocomplete="new-code" style="width:78%;">
	            	<button class="getcode">获取</button>
	            </div>
	        </div>
	        <p class="errorinfo" style="text-align:center;line-height:20px;color:#E64340;font-size:14px;height:20px;margin-top:-20px;"></p>
	        <button class="delsite_btn" onclick="_hmt.push(['_trackEvent', '登录', 'click', '抓娃娃登录', 1])">登录</button>
	    </div>
	</section>
	<script type="text/javascript" src="src/js/jquery-1.10.1.min.js?__version=9.4"></script>
	<script type="text/javascript" src="src/js/init.js?__version=9.4"></script>
	<script type="text/javascript">
		var tt=60;
		$(".getcode").click(function(){
			$(".getcode").attr("disabled",true);
			var phone = $("#account").val();
			$.ajax({
		        type:"post",
		        url:api_url+"/OpenAPI/v1/SMS/sendSMS",
		        jsonp:'callback',
		        dataType:'jsonp',
		        data:{"phone":phone},
		        success:function(data){
		        	console.log(data)
		            if(data.code == "401") {
		                //用户没有登录
		                logout();
		            } else if(data.code == "0") {
		            	$(".errorinfo").html(data.data)
		                var time=setInterval(function(){
							tt--;
							$(".getcode").text(tt+'s');
							if(tt<=0){
								tt=60;
								$(".getcode").text("获取").attr("disabled",false);
								clearInterval(time);
							}
						},1000)
		            } else {
		                //错误信息
		                $(".errorinfo").html(data.msg)
		                $(".getcode").text("获取").attr("disabled",false);
		            }
		        }
		    })
		})

		$(document).on("click",".delsite_btn",function(){
			var phone = $("#account").val();
			var code = $("#code").val();

			login(phone,code);
		});

		function login(phone,captcha) {
			$.ajax({
		        type:"post",
		        url:api_url+"/OpenAPI/v1/SMS/verify",
		        jsonp:'callback',
		        dataType:'jsonp',
		        data:{"phone":phone,"captcha":captcha,"referee_id":cookieGet('recommend')},
		        success:function(data){
		        	console.log(data)
		            if(data.code == "401") {
		                //用户没有登录
		                logout();
		            } else if(data.code == "0") {
		                cookieSet("uid",data.data.uid);
						cookieSet("token",data.data.token);
						cookieSet("nickname",data.data.nickname);
						cookieSet("avatar",data.data.avatar);
						cookieSet("is_register",data.data.is_register);
						cookieSet("coinbalance",data.data.coinbalance);

						var url = cookieGet("url");
						if(url) {
							location.href = url;
						} else {
							location.href = index_url;
						}
		            } else {
		                //错误信息
		                $(".errorinfo").html(data.msg)
		            }
		        }
		    })
		}
	</script>
	
</body>
</html>